﻿@model BestEasyCMS.Service.Messages.FindPageResponse<BestEasyCMS.Service.Views.Security.RoleView>

@{
    ViewBag.Title = "角色列表";
    
}

<div class="row">
    <div class="col-xs-12">
        <div class="table-responsive">
            <table id="sample-table-1" class="table table-striped table-bordered table-hover">
                <thead>
                    <tr>
                        <th class="center">
                            <label>
                                <input type="checkbox" class="ace" />
                                <span class="lbl"></span>
                            </label>
                        </th>
                        <th>角色名</th>
                        <th class="hidden-480">备注</th>
                        <th class="hidden-480">是否启用</th>
                        <th>操作</th>
                    </tr>
                </thead>

                <tbody>
                    @if (Model.Page != null && Model.Page.Items.Any())
                    {
                        foreach (var item in Model.Page.Items)
                        {
                        <tr>
                            <td class="center">
                                <label>
                                    <input type="checkbox" class="ace" />
                                    <span class="lbl"></span>
                                </label>
                            </td>
                            <td>
                                <a href="#">@item.RoleName</a>
                            </td>
                            <td class="hidden-480">@item.Remarks</td>
                            <td class="hidden-480">
                                @if (item.IsEnable == true)
                                {
                                    <span class="label label-sm label-success">正常</span>
                                }
                                else
                                {
                                    <span class="label label-sm label-danger">禁用</span>
                                }
                            </td>

                            <td>
                                <div class="visible-md visible-lg hidden-sm hidden-xs btn-group">
                                    <button class="btn btn-xs btn-success">
                                        <i class="icon-ok bigger-120"></i>
                                    </button>

                                    <button class="btn btn-xs btn-info">
                                        <i class="icon-edit bigger-120"></i>
                                    </button>

                                    <button class="btn btn-xs btn-danger">
                                        <i class="icon-trash bigger-120"></i>
                                    </button>

                                    <button class="btn btn-xs btn-warning">
                                        <i class="icon-flag bigger-120"></i>
                                    </button>
                                </div>
                                <div class="visible-xs visible-sm hidden-md hidden-lg">
                                    <div class="inline position-relative">
                                        <button class="btn btn-minier btn-primary dropdown-toggle" data-toggle="dropdown">
                                            <i class="icon-cog icon-only bigger-110"></i>
                                        </button>

                                        <ul class="dropdown-menu dropdown-only-icon dropdown-yellow pull-right dropdown-caret dropdown-close">
                                            <li>
                                                <a href="#" class="tooltip-info" data-rel="tooltip" title="View">
                                                    <span class="blue">
                                                        <i class="icon-zoom-in bigger-120"></i>
                                                    </span>
                                                </a>
                                            </li>

                                            <li>
                                                <a href="#" class="tooltip-success" data-rel="tooltip" title="Edit">
                                                    <span class="green">
                                                        <i class="icon-edit bigger-120"></i>
                                                    </span>
                                                </a>
                                            </li>

                                            <li>
                                                <a href="#" class="tooltip-error" data-rel="tooltip" title="Delete">
                                                    <span class="red">
                                                        <i class="icon-trash bigger-120"></i>
                                                    </span>
                                                </a>
                                            </li>
                                        </ul>
                                    </div>
                                </div>
                            </td>
                        </tr>
                        }
                    }
                    else
                    {

                    }
                </tbody>
            </table>
        </div>
        <!-- /.table-responsive -->
    </div>
    <!-- /span -->
</div>

@section Scripts {
    <script type="text/javascript">
        jQuery(function ($) {
            $('table th input:checkbox').on('click', function () {
                var that = this;
                $(this).closest('table').find('tr > td:first-child input:checkbox')
                    .each(function () {
                        this.checked = that.checked;
                        $(this).closest('tr').toggleClass('selected');
                    });
            });
        });
    </script>
}